﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using CQIE.TES.IService;
using CQIE.TES.Model;

namespace CQIE.TES.WEB.ADMIN.Controllers.Record
{
    public class RecordAPIController : ApiController
    {
        public IRecordService RecordService { get; set; }

        [HttpGet]
        [Route("api/record/table")]
        public object GetTableData(int limit,int page,string searchString="")
        {
            var data = RecordService.GetTableData(limit, page, searchString,out int count);
            return new
            {
                code=0,
                msg='s',
                data,
                count
            };
        }

        /// <summary>
        /// 获取总走势图 数据
        /// </summary>
        /// <returns>4个数组  优秀>75 良好50~75 一般25~50 较差<25</returns>
        [HttpGet]
        [Route("api/record/allLineData")]
        public object GetLineData()
        {
            // data返回数据：
            // lineData  pieData
            // lineData: l1 l2 l3 l4 studyYearList
            // pieData: [{name:'优秀',value:xxx},···]
            object data = RecordService.GetEvaTrend();

            return data;
        }



        [HttpGet]
        [Route("api/detail/getteacherinfo")]
        public object GetTeacherInfo(int tid)
        {
            var res = RecordService.GetDetailAllInfo(tid);
            return res;
        }
    }
}
